package com.wf.course.dao;

import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.xmlbeans.impl.xb.xsdschema.impl.PublicImpl;

import com.utils.page.PageBean;
import com.wf.course.model.goods.GoodsOrderRelation;

/**
 * 播放记录
 *
 */
public interface IGoodsOrderRelationMapper {

	/**
	 * 根据pageBean中封装的查询条件查询
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> queryList(PageBean<GoodsOrderRelation> pageBean);
	/**
	 * 查询总数量
	 * @param pageBean
	 * @return
	 */
	public Integer getTotalCount(PageBean<GoodsOrderRelation> pageBean);
	/**
	 * 添加
	 * @param 
	 */
	public void saveGoodsOrderRelation(GoodsOrderRelation goodsOrderRelation);
	/**
	 * 修改
	 * @param 
	 */
	public void updateGoodsOrderRelation(GoodsOrderRelation goodsOrderRelation);
	/**
	 * 查询
	 * @param id
	 */
	public GoodsOrderRelation queryGoodsOrderRelationById(@Param("id")Integer id);
	/**
	 * 删除
	 * @param id
	 */
	public void deleteById(@Param("id")Integer id);
	/**
	 * 批量保存
	 * @param list
	 */
	public void saveBatchGoodsOrderRelation(List<GoodsOrderRelation> list);
	
	/**
	 * 
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> queryOrderGoodsList(String orderCode) ;
	/**
	 * 根据订单编号，查询订单详情
	 * @param orderCode
	 * @return
	 */
	public List<GoodsOrderRelation> queryOrderGoodsListByOrderCode(@Param("orderCode") String orderCode) ;
	
	/**
	 * 
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> getCourseAmount(@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime) ;
	/**
	 * 
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> getGoodsAmount(@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime) ;
	/**
	 * 根据订单号删除
	 * @param OrderCode
	 * @return
	 */
	public void deleteByOrderCode(@Param("OrderCode")String OrderCode);
	
	
	/**
	 * 统计各商品销售情况
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> getGoodsSale(PageBean<GoodsOrderRelation> pageBean);
	
	/**
	 * 统计各商品销售情况,总数量
	 * @param pageBean
	 * @return
	 */
	public Integer getGoodsSaleNum(PageBean<GoodsOrderRelation> pageBean);
	
	
	/**
	 * 统计各商品销售总量
	 * @param goodsId
	 * @param goodsSort
	 * @param userSource
	 * @param orderBeginTime
	 * @param orderEndTime
	 * @return
	 */
	public List<GoodsOrderRelation> getGoodsCount(
			@Param("goodsId")Integer goodsId,
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime,
			@Param("speakerName")String speakerName
			);
	
	/**
	 * 按查询条件统计商品的总运费
	 * @param goodsId
	 * @param goodsSort
	 * @param userSource
	 * @param orderBeginTime
	 * @param orderEndTime
	 * @return
	 */
	public GoodsOrderRelation getGoodsFreight(
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime
			);
	
	
	/**
	 * 根据pageBean中封装的查询条件查询
	 * @param pageBean
	 * @return
	 */
	public List<GoodsOrderRelation> exportGoodSales(PageBean<GoodsOrderRelation> pageBean);
	
	/**
	 * 根据商品编号和类型，查询支付成功的订单列表
	 * @param goodsId
	 * @param goodsSort
	 * @return
	 */
	public List<GoodsOrderRelation> getOrdersByGoodsIdAndType(
			@Param("goodsId")Integer goodsId, @Param("goodsSort")Integer goodsSort,@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime);
	
	
	/**
	 * 修改退货标识
	 * @param id
	 */
	public void updateBackFlag(@Param("id")Integer id);
	
	/**
	 * 商品销售统计
	 * @param goodsSort
	 * @return
	 */
	public List<String> goodsSalesStatistics(@Param("goodsSort") Integer goodsSort);
	
	/**
	 * 商品销售统计-时间段
	 * @return
	 */
	public List<String> goodsSalesStatisticsTimes();
	
	/**
	 * 商品分类销售查询
	 * @param goodsSort
	 * @param id
	 * @return
	 */
	public List<String> goodsCategoriesSales(@Param("goodsSort") Integer goodsSort,@Param("id") Integer id);
	
	/**
	 * 根据小时查询商品分类销售量
	 * @param goodsSort
	 * @param id
	 * @param orderPayTime
	 * @return
	 */
	public ArrayList<GoodsOrderRelation> goodsCategoriesSalesByTimes(@Param("goodsSort") Integer goodsSort,@Param("id") Integer id,@Param("orderPayTime") String orderPayTime);
	
	/**
	 * 根据日期查询商品分类销售量（按选中时间近七日：前四日后两日）
	 * @param goodsSort
	 * @param id
	 * @param orderPayTime
	 * @return
	 */
	public ArrayList<GoodsOrderRelation> goodsCategoriesSalesByDay(@Param("goodsSort") Integer goodsSort,@Param("id") Integer id,@Param("orderPayTime") String orderPayTime);
	
	/**
	 * 根据订单编号，批量更新该订单下所有关系表中商品的状态
	 * @param orderCode
	 * @param backFlag
	 */
	public void updateGoodsOrderRelationByorderCode(@Param("orderCode") String orderCode,@Param("backFlag") Integer backFlag);
	/**
	 * 根据订单编号，批量更新该订单下所有关系表中订单状态
	 * @param orderCode
	 * @param backFlag
	 */
	public void updateGoodsOrderRelationByorderStatus(@Param("orderCode") String orderCode,@Param("orderStatus") Integer orderStatus);
	/**
	 * 根据上商品编号去查询二级分类
	 * @param orderCode
	 * @param backFlag
	 */
	public List<GoodsOrderRelation> getGoodsCcname(
			@Param("goodsId")Integer goodsId,
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime
			);
	public List<GoodsOrderRelation> getSpeakerName(
			@Param("goodsId")Integer goodsId,
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime
			);
	public List<GoodsOrderRelation> getCopperCome(
			@Param("goodsId")Integer goodsId,
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime, 
			@Param("orderEndTime")String orderEndTime
			);
	
	public List<GoodsOrderRelation> getOrderCodes(@Param("orderCode") String orderCode);
	
	public List<GoodsOrderRelation> getOrderCodesName(@Param("goodsid") Integer goodsid);
	
	public List<GoodsOrderRelation> getGoodsid(@Param("goodsid") Integer goodsid);

	List<GoodsOrderRelation> newExportGoodSales(
			@Param("goodsSort")Integer goodsSort,
			@Param("userSource")String userSource,
			@Param("orderBeginTime")String  orderBeginTime,
			@Param("orderEndTime")String orderEndTime,
			@Param("speakerName")String speakerName);

	List<GoodsOrderRelation> newGetGoodsSale(PageBean<GoodsOrderRelation> pageBean);

	Integer newGetGoodsSaleNum(PageBean<GoodsOrderRelation> pageBean);

	List<GoodsOrderRelation> exportPurchaseAmountExcel(
			@Param("beginTime") String beginTime,
			@Param("endTime") String endTime);

	List<GoodsOrderRelation> purchaseAmountList(PageBean<GoodsOrderRelation> pageBean);

	Integer purchaseAmountCount(PageBean<GoodsOrderRelation> pageBean);
}
